package cn.didi.feidi.location.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.amap.api.navi.AMapNaviView;
import com.amap.api.navi.enums.NaviType;

import cn.didi.feidi.location.R;
import cn.didi.feidi.location.activity.base.BaseNavigationActivity;
import cn.didi.feidi.location.other.TTSController;

/**
 * Created by jinxiong on 2017/7/11.
 */

public class NavigationActivity extends BaseNavigationActivity {

    private static final String TAG = "NavigationActivity";
    /**
     * AMapNaviView mNaviView;
     * AMapNavi mAMapNavi;
     */
    TTSController mTtsManager;//语音

    public static void startThisActivity(Activity activity) {
        Intent intent = new Intent(activity, NavigationActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initView(Bundle saveInstanctate) {
        setContentView(R.layout.act_location_navigation);
        mNaviView = (AMapNaviView) this.findViewById(R.id.navigation_view);

    }

    @Override
    protected void initVariables() {

        //初始化
        mTtsManager = TTSController.getInstance(getApplication());
        mTtsManager.init();
        mAMapNavi.addAMapNaviListener(mTtsManager);

        //模拟
        // TODO: 2017/8/16 模拟导航，后期改为真实导航 ---jinXiong
        mAMapNavi.setEmulatorNaviSpeed(60);
        mAMapNavi.startNavi(NaviType.EMULATOR);
    }

    @Override
    protected void onPause() {
        super.onPause();
        mTtsManager.stopSpeaking();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mTtsManager.destroy();
    }

    @Override
    protected void loadData() {

    }
}
